package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.dto.ImportDTO;
import com.ruoyi.system.domain.dto.SlideshowDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SlideshowMapper;
import com.ruoyi.system.domain.Slideshow;
import com.ruoyi.system.service.ISlideshowService;
import com.ruoyi.common.core.text.Convert;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;

/**
 * 轮播图Service业务层处理
 *
 * @author ruoyi
 * @date 2020-10-24
 */
@Service
public class SlideshowServiceImpl implements ISlideshowService {
    @Autowired
    private SlideshowMapper slideshowMapper;

    /**
     * 查询轮播图
     *
     * @param id 轮播图ID
     * @return 轮播图
     */
    @Override
    public Slideshow selectSlideshowById(Long id) {
        return slideshowMapper.selectSlideshowById(id);
    }

    /**
     * 查询轮播图列表
     *
     * @param slideshow 轮播图
     * @return 轮播图
     */
    @Override
    public List<Slideshow> selectSlideshowList(Slideshow slideshow) {
        return slideshowMapper.selectSlideshowList(slideshow);
    }

    /**
     * 新增轮播图
     *
     * @param slideshow 轮播图
     * @return 结果
     */
    @Override
    public int insertSlideshow(Slideshow slideshow) {
        slideshow.setCreateTime(DateUtils.getNowDate());
        return slideshowMapper.insertSlideshow(slideshow);
    }

    /**
     * 修改轮播图
     *
     * @param slideshow 轮播图
     * @return 结果
     */
    @Override
    public int updateSlideshow(Slideshow slideshow) {
        return slideshowMapper.updateSlideshow(slideshow);
    }

    /**
     * 删除轮播图对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteSlideshowByIds(String ids) {
        return slideshowMapper.deleteSlideshowByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除轮播图信息
     *
     * @param id 轮播图ID
     * @return 结果
     */
    @Override
    public int deleteSlideshowById(Long id) {
        return slideshowMapper.deleteSlideshowById(id);
    }

    /**
     * 轮播图
     */

    @Override
    public AjaxResult slideshow() {

        List<String> list = slideshowMapper.slideshow();

        return AjaxResult.success(list);

    }

}
